<template>
  <view>
    <view style="height:24rpx;">
    </view>
    <view :style="'height:'+statusBarHeight+'px;'">
    </view>
    <view class="searchBox">
      <image class="navLeftIcon" src="/static/images/nav-left.png" mode="" @click.stop="goback()"></image>
      <u-search style="width: 100%;" maxlength="45" placeholder="输入搜索内容" :action-style="actionStyle" search-icon="/static/images/search.png" v-model="query.keyword" @clear="onSearch('clear')" action-text="搜索" @custom="onSearch('search')"></u-search>
    </view>
    <view class="content-box">
      <view style="height: 32rpx;">
      </view>
      <user v-if="true" :query="query" :screenHeight="screenHeight" :excessHeight="excessHeight" ref="user"></user>
    </view>
  </view>
</template>

<script>
import user from '../../componets/user/index'
export default {
  components: {
    user
  },
  data() {
    return {
      statusBarHeight: uni.getStorageSync('statusBarHeight'),
      excessHeight: 88,
      screenHeight: '',
      value: '',
      actionStyle: {
        'font-size': '28rpx',
        'font-family': 'PingFang SC-Medium, PingFang SC',
        'font-weight': '500',
        'color': '#999999',
      },
      // 必传参数 
      query: {
        types: '',//帖子类型:1=交流圈,2=二手乐器,3=求货,4=代加工
        position: '9',//请求位置:3=搜索页,7=用户关注列表,8=用户粉丝列表
        search: '',
        keyword: ''
      },
    }
  },
  onLoad() {
    const result = uni.getSystemInfoSync();
    let safeAreaBottom = uni.getSystemInfoSync().screenHeight - uni.getSystemInfoSync().safeArea.height;
    this.screenHeight = uni.getStorageSync('screenHeight') - safeAreaBottom - this.statusBarHeight;
  },
  methods: {
    onSearch(type) {
      if (type == 'clear') {
        this.query.keyword = ''
      };
      this.$refs['user'].init();
    },
    goback() {
      uni.navigateBack()
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
